﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.GamerServices;
using Antioch.Base;


namespace Antioch
{
    public class _CommandLineArguments
    {
        public String Episode { get; set; }
        public String StartMap { get; set; }
        public String FireNode { get; set; }
        public Dictionary<String, int> SaveStateOverrides = new Dictionary<string, int>();
        public int Width { get; set; }
        public int Height { get; set; }

        public _CommandLineArguments()
        {
            Episode = "Antioch.Content";
            Width = 800;
            Height = 600;
        }
    }

    public class Screen
    {
       

        internal static _CommandLineArguments CommandLineArguments { get; set; }
		public static Main Parent { get; set; }
		public static PlayerIndex MainController { get; set; }
		public static GraphicsDevice GraphicsDevice { get; set; }
        public static GraphicsDeviceManager GraphicsDeviceManager { get; set; }
		public static SpriteBatch SpriteBatch { get; set; }
		public static ContentManager Content { get; set; }
		public static GameComponentCollection Components { get; set; }
		public static Microsoft.Xna.Framework.Game Game { get; set; }
        public static EventBasedInput Input { get; set; }

		public static EasyStorage.SaveDevice SaveDevice;

		static List<Screen> screenStack = new List<Screen>();

		public static void PushScreen(Screen screen)
		{
			screenStack.Add(screen);
			screen.Initialize();
		}

		public static void PopScreen()
		{
			if (screenStack.Count != 0)
			{
				screenStack[screenStack.Count - 1].Destroy();
				screenStack.RemoveAt(screenStack.Count - 1);
			}
		}

		public static Screen TopScreen
		{
			get
			{
				if (screenStack.Count > 0) return screenStack[screenStack.Count - 1];
				else return null;
			}
		}

		public static List<Screen> Screens { get { return screenStack; } }

		

        public virtual void Initialize() { }
		public virtual void Destroy() { }

        public virtual void Update(GameTime gameTime) { }

        public virtual void Draw() { }

        public virtual void ButtonEvent(PlayerIndex index, EventBasedInput.Buttons button, EventBasedInput.EventTypes type, TimeSpan duration) { }
        public virtual void StickEvent(PlayerIndex index, EventBasedInput.Sticks stick, EventBasedInput.EventTypes type, Vector2 delta, TimeSpan duration) { }
        public virtual void TriggerEvent(PlayerIndex index, EventBasedInput.Triggers trigger, EventBasedInput.EventTypes type, float delta, TimeSpan duration) { }
    }
}
